import { useTable, LIST_TYPE } from '@crud/index';

// 查询

// 抖音状态
export const accountStateOptions: any[] = [
  { label: '全部', value: undefined },
  { label: '在线中', value: 1 },
  { label: '已掉线', value: 2 },
  { label: '已封禁', value: 3 }
];

// 监控状态
export const monitorStateOptions: any[] = [
  { label: '全部', value: undefined },
  { label: '监控中', value: 1 },
  { label: '未监控', value: 0 }
];

// 橱窗等级
export const shwoCaseLevelMap = {
  0: '-',
  1: 'LV1',
  2: 'LV2',
  3: 'LV3',
  4: 'LV4',
  5: 'LV5',
  6: 'LV6',
  7: 'LV7'
};

// 表格
export const useTableList = (options: any = {}) => {
  const columns = [
    { label: '抖音号', prop: 'unique_id', width: 350, render: 'unique_id', fixed: 'left' },
    { label: '监控', prop: 'monitoring', width: 120, render: (s: any) => s.row.is_monitor ? '监控中' : '未监控', headerSlot: 'monitoringTitle' },
    { label: '千川授权', prop: 'qc_authorized', width: 120, render: 'qc_authorized', headerSlot: 'qcAuthorizedTitle' },
    { label: '小组', prop: 'group_title', minWidth: 120, tooltip: true },
    { label: '成员', prop: 'user_name', minWidth: 120, tooltip: true },
    { label: '版本', prop: 'is_upgrade', width: 120, render: (s: any) => s.row.is_upgrade ? 'DOU+升级版' : 'DOU+' },
    { label: 'DOU+余额', prop: 'hot_balance', width: 130, type: 'price' },
    { label: '随心推余额', prop: 'ecp_balance', width: 130, type: 'price' },
    { label: '总粉丝数', prop: 'followers', width: 130, render: 'followers' },
    { label: '可提现佣金', prop: 'commission', width: 140, type: 'price', headerSlot: 'commissionTitle' },
    { label: '橱窗', prop: 'is_with_fusion_shop', width: 120, render: (s: any) => s.row.is_with_fusion_shop ? '有' : '无' },
    { label: '手机号', prop: 'mobile', width: 130, render: 'mobile' },
    { label: '授权时间', prop: 'authorization_time', width: 177, render: 'authorization_time' },
    { label: '操作', align: 'center', width: 120, render: 'actions', fixed: 'right' }
  ];

  return useTable({
    ...options,
    type: LIST_TYPE.DYJ,
    params: {
      account_info: undefined,
      group_id: '',
      member_id: '',
      state: undefined,
      is_monitor: undefined
    },
    columns
    // getList
  });
};

/** 操作日志 表格 */
export const useLogsTableList = (options = {}) => {
  const columns = [
    { label: '操作账号', prop: 'nick_name', width: 200, render: 'unique_id', fixed: 'left' },
    { label: '手机号', prop: 'mobile', width: 130, render: (s: any) => s.row.is_monitor ? '监控中' : '未监控', headerSlot: 'monitoringTitle' },
    { label: '授权时间', prop: 'authorization_time', width: 177, type: 'dateTime' },
    { label: '上次掉线时间', prop: 'offline_time', minWidth: 177, type: 'dateTime' }
  ];

  return useTable({
    ...options,
    type: LIST_TYPE.DYJ,
    params: {},
    columns
  });
};
